/**
 * Copyright 2014-2021 the original author or authors.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.webank.webase.node.mgr.deploy.entity;

import java.util.Date;

import com.webank.webase.node.mgr.base.enums.ConfigTypeEnum;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@EqualsAndHashCode
@ToString
@NoArgsConstructor
public class TbConfig {

    public static TbConfig init(ConfigTypeEnum type,String value){
        Date now = new Date();

        TbConfig config = new TbConfig();
        config.setConfigName(type.getName());
        config.setConfigType(type.getId());
        config.setConfigValue(value);
        config.setCreateTime(now);
        config.setModifyTime(now);

        return config;
    }

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_config.id
     *
     * @mbg.generated
     */
    private Integer id;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_config.config_name
     *
     * @mbg.generated
     */
    private String configName;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_config.config_type
     *
     * @mbg.generated
     */
    private Integer configType;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_config.config_value
     *
     * @mbg.generated
     */
    private String configValue;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_config.create_time
     *
     * @mbg.generated
     */
    private Date createTime;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_config.modify_time
     *
     * @mbg.generated
     */
    private Date modifyTime;
}